﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using gsToolkit;

namespace CoApp {
    [Serializable()]
    class Project {
        private static Regex rx = new Regex(@"([0-9]*)\.([0-9]*)\.([0-9]*)\.([0-9]*)");
        public string NAME;
        public string PUBLICKEYTOKEN;
        public string VERSION = "1.0.0.0";
        public string VENDOR;
        public string BINARY_DIR;
        public string DLL;
        public string MANIFEST;
        public string CATALOG;
        public string COMPILER; // VC9 | VC10
        public List<string> FILES = new List<string>();

        internal int Major { 
            set {
                Match match = rx.Match(VERSION);
                VERSION = "{0}.{1}.{2}.{3}".format(value, match.Captures[1], match.Captures[2], match.Captures[3]);
            } get {
                int m;
                Match match = rx.Match(VERSION);
                if(!Int32.TryParse(match.Captures[0].Value, out m))
                    Program.Fail("Project Version does not conform to #.#.#.#");
                return m;
            } 
        }
        internal int Minor { set; get; }
        internal int Revision { set; get; }
        internal int Build{ set; get; }
        
        internal bool SaveSettings {set;get;}

        
    }
}
